package com.how.warlock.engine;

import static org.lwjgl.opengl.GL11.*;

public class Texture {
	private int target;
	private int targetID;
	
	//Image dimensions
	private int width;
	private int height;
	
	//Texture dimensions
	private int texWidth;
	private int texHeight;
	
	//Image - Texture Ratio
	private float widthRatio;
	private float heightRatio;
	
	public Texture(int target, int targetID){
		this.target = target;
		this.targetID = targetID;
	}
	
	public void bind(){
		glBindTexture(target, targetID);
	}
	
	public void setWidth(int width){
		this.width = width;
		setWidth();
	}
	
	public void setWidth(){
		if(texWidth!=0){
			widthRatio = ((float) width / texWidth);
		}
	}
	
	public void setHeight(int height){
		this.height = height;
		setHeight();
	}
	
	public void setHeight(){
		if(texHeight!=0){
			heightRatio = ((float) height) / texHeight;
		}
	}
	
	public void setTextureWidth(int texWidth){
		this.texWidth = texWidth;
	}
	
	public void setTextureHeight(int texHeight){
		this.texHeight = texHeight;
	}
	
	public int getImageWidth(){
		return width;
	}
	
	public int getImageHeight(){
		return height;
	}
	
	public float getWidth(){
		return widthRatio;
	}
	
	public float getHeight(){
		return heightRatio;
	}
	
	
}
